const constant = {
  DR: '/drools-engine',
  SUCCESS: '0',
  FAIL: '1',
  ADD:'0',
  EDIT:'1',
  DEL:'2',

  routerName:{
     viewVersionFlow:'drools-version/view-flow',
     listVersionFlow:'drools-version/flowlist',
     listAuditFlow:'drools-version/flowauditlist',
     listReleaseFlow:'drools-release/flowlist',

     viewVersionGroup:'drools-version/view-group',
     listVersionGroup:'drools-version/rulegrouplist',
     listReleaseGroup:'drools-release/rulegrouplist',
     listAuditGroup:'drools-version/rulegroupauditlist',

     addEntity:'drools-baseConfig/entity/add-or-update',
     viewEntity:'drools-baseConfig/entity/view-data',
     listEntity:'drools-baseConfig/entity/list',

     addInterfaceTemplate:'drools-testCase/interfaceTemplate/add-or-update',
     listInterfaceTemplate:'drools-testCase/interfaceTemplate/list',

     addGroupCase:'drools-testCase/groupCase/add-or-update',
     listGroupCase:'drools-testCase/groupCase/list',

     addInterfaceCase:'drools-testCase/interfaceCase/add-or-update',
     listInterfaceCase:'drools-testCase/interfaceCase/list',

     addConditionDivisor:'drools-baseConfig/conditionDivisor/add-or-update',
     listConditionDivisor:'drools-baseConfig/conditionDivisor/list',

     addActionDivisor:'drools-baseConfig/actionDivisor/add-or-update',
     listActionDivisor:'drools-baseConfig/actionDivisor/list',

     addGroup:'drools-ruleConfig/group/add-or-update',
     listGroup:'drools-ruleConfig/group/list',

     addRule:'drools-ruleConfig/rule/add-or-update',
     listRule:'drools-ruleConfig/rule/list',
     listBranchRule:'drools-ruleConfig/branch/list',

     listFlow:'drools-ruleConfig/flow/list',
     addFlow:'drools-ruleConfig/flow/edit-flow',

     listScene:'drools-ruleConfig/scene/list',
     addScene:'drools-ruleConfig/scene/edit-flow',
     flowCompare:'drools-version/flowcompare',
     ruleGroupCompare:'drools-version/rulegroupcompare',
     groupDetail: 'drools-version/groupdetail',
     flowDetail: 'drools-version/flowdetail',
     viewVersionTask:'drools-version/view-task',
  },

  ruleConfig:{
    formulaType: [
      {label: '住院收据', value: '3'},
      {label: '门诊收据', value: '2'},
      {label: '药房收据', value: '1'},
      {label: '非医疗收据', value: '0'},
    ],
    excuteTypes:[
      {label:"已选择",value:"Y"},
      {label:"不选择",value:"N"}
    ],
    entityItemType:[
      {label:"String",value:"String"},
      {label:"List",value:"List"},
      {label:"Date",value:"Date"},
      {label:"Long",value:"Long"},
      {label:"Integer",value:"Integer"},
      {label:"Double",value:"Double"}
    ],
    divisorTypes:[
      {label:"方法",value:"1"},
      {label:"非方法",value:"0"},
      {label:"自定义",value:"3"},
    ],
    valueTypes:[
      {label:"固定值",value:"1"},
      {label:"输入值",value:"2"}
    ],
    itemValueTypes:[
      {label:"新增枚举",value:"2"},
      {label:"文本输入",value:"1"},
      {label:"模型属性",value:"3"},
    ],
    itemValueTypes1:[
      {label:"文本输入",value:"1"},
      {label:"模型属性",value:"3"},
    ],
    itemTxtTypes:[
      {label:"数字",value:"1"},
      {label:"日期",value:"2"},
      {label:"文本",value:"3"}
    ],
    sysbols: [
      {label: '==', value: '1',zh:'等于'},
      {label: '!=', value: '2',zh:'不等于'},
      {label: '<=', value: '3',zh:'小于等于'},
      {label: '<', value: '4',zh:'小于'},
      {label: '>=', value: '5',zh:'大于等于'},
      {label: '>', value: '6',zh:'大于'}
    ],
    actionSysbols: [
      {label: '==', value: '1',zh:'等于'}
    ],
    conditionTyps: [
      {label: '模型属性', value: '1'},
      {label: '方法', value: '2'},
      {label: '模型值', value: '3'},
      {label: '已定义条件', value: '4'}
    ],
    actionTyps: [
      {label: '模型属性', value: '1'},
      {label: '方法', value: '2'},
      {label: '模型值', value: '3'},
      {label: '已定义动作', value: '4'}
    ],
    templateTypes: [
      {label: '请求', value: '1'},
      {label: '返回', value: '2'}
    ],
    isEffects: [
      {label: '有效', value: '1'},
      {label: '失效', value: '0'}
    ],
    changeStauts: [
      {label: '修改', value: '1'},
      {label: '新增', value: '0'}
    ],
    branchOperType: [
      {label: '更新(有冲突)', value: '1'},
      {label: '已添加', value: '2'},
      {label: '已删除', value: '3'},
      {label: '无变动', value: '4'},
    ],
    flowTypes: [
      {label: '执行规则节点', value: '2', status: 'ing'},
      {label: '循环节点', value: '3', status: 'circle'},
      {label: '其他', value: '4', status: 'done'},
      {label: '判断节点', value: '5', status: 'if'},
      {label: '子流程', value: '6', status: 'cflow'},
      {label: '源码节点', value: '7', status: 'source'}
    ],
    groupTypes: [
      {label: '普通形式', value: '1'},
      {label: '决策表', value: '2'}
    ],

  },

  eventDate:{
    //理赔形态
    claimTypeProperties:[
      {label:"P-部分残疾",value:"P"},
      {label:"T-全残",value:"T"},
      {label:"C-重大疾病",value:"C"},
      {label:"D-身故",value:"D"},
    ],
    //出险年龄条件
    cltdobConProperties:[
      {label:"不选择",value:""},
      {label:"出险年龄大于65",value:"1"}
    ],
    //意外事故日
    acdtDteConProperties:[
      {label:"不选择",value:""},
      {label:"等于0",value:"1"},
      {label:"不等于0",value:"2"}
    ],
    //入院日期是否为空
    earlyHsDteProperties:[
      {label:"不选择",value:""},
      {label:"是",value:"1"},
      {label:"不是",value:"2"}
    ],
    //事故认定日
    eventDateProperties:[
      {label:"身故/残疾/重大疾病认定日",value:"1"},
      {label:"意外事故日",value:"2"},
      {label:"最早的入院日期",value:"3"},
      {label:"最早的手术日期",value:"4"},
      {label:"最早的就医信息",value:"5"}
    ]
  },
  benefitmula:{
    //理赔形态
    claimTypeProperties:[
      {label:"不做选择",value:"不做选择"},
      {label:"D-身故",value:"D-身故"},
      {label:"C-重大疾病",value:"C-重大疾病"},
      {label:"T-全残",value:"T-全残"},
      {label:"T-全残P-部分残疾",value:"T-全残P-部分残疾"},
      {label:"D-身故T-全残P-部分残疾",value:"D-身故T-全残P-部分残疾"},
      {label:"C-重大疾病D-身故",value:"C-重大疾病D-身故"},
    ],

    dateTypeProperties:[
      {label:"不做选择",value:"不做选择"},
      {label:"重大疾病/残疾/身故认定日落在有效期",value:"重大疾病/残疾/身故认定日落在有效期"},
      {label:"重大疾病/残疾/身故认定日落在有效期且意外事故日非空",value:"重大疾病/残疾/身故认定日落在有效期且意外事故日非空"},
      {label:"重大疾病/残疾/身故认定日落在有效期且意外事故日为空",value:"重大疾病/残疾/身故认定日落在有效期且意外事故日为空"},
      {label:"意外事故日落在有效期内，且DD不大于AD后的180天",value:"意外事故日落在有效期内，且DD不大于AD后的180天"},
    ],

    ageTypeProperties:[
      {label:"不做选择",value:"不做选择"},
      {label:"小于1周岁",value:"小于1周岁"},
      {label:"大于等于1周岁并小于2周岁",value:"大于等于1周岁并小于2周岁"},
      {label:"大于等于2周岁",value:"大于等于2周岁"},
      {label:"小于18周岁",value:"小于18周岁"},
      {label:"大于等于18周岁",value:"大于等于18周岁"},
      {label:"小于50周岁",value:"小于50周岁"},
      {label:"小于60周岁",value:"小于60周岁"},
      {label:"大于等于60周岁",value:"大于等于60周岁"},
      {label:"小于65周岁",value:"小于65周岁"},
      {label:"大于等于65周岁",value:"大于等于65周岁"},
      {label:"小于等于70周岁",value:"小于等于70周岁"},
      {label:"大于70周岁",value:"大于70周岁"},
      {label:"小于等于75周岁",value:"小于等于75周岁"},
      {label:"大于75周岁",value:"大于75周岁"},
      {label:"小于80周岁",value:"小于80周岁"},
      {label:"大于等于18周岁小于70周岁",value:"大于等于18周岁小于70周岁"},
      {label:"小于25周岁",value:"小于25周岁"},
      {label:"大于等于18周岁小于75周岁",value:"大于等于18周岁小于75周岁"},
      {label:"大于等于2周岁小于18周岁",value:"大于等于2周岁小于18周岁"},

    ],
    arrivalAgeProperties:[
      {label:"不做选择",value:"不做选择"},
      {label:"18-40周岁",value:"18-40周岁"},
      {label:"41-60周岁",value:"41-60周岁"},
      {label:"61-80周岁",value:"61-80周岁"},
      {label:"大于等于61周岁",value:"大于等于61周岁"},
      {label:"小于等于40周岁",value:"小于等于40周岁"},
      {label:"小于等于17周岁",value:"小于等于17周岁"},
      {label:"18-36周岁",value:"18-36周岁"},
    ],

    paieSaveTypeeProperties:[
      {label:"不做选择",value:"不做选择"},
      {label:"已领生存金期数等于0",value:"已领生存金期数等于0"},
      {label:"已领生存金期数大于0并且小于10",value:"已领生存金期数大于0并且小于10"},
      {label:"已领生存金期数大于等于10",value:"已领生存金期数大于等于10"},
    ],
    illTypeProperties:[
      {label:"不做选择",value:"不做选择"},
      {label:"伤病代码等于",value:"伤病代码等于"},
      {label:"伤病代码类似于",value:"伤病代码类似于"},
      {label:"新伤残代码等于",value:"新伤残代码等于"},
      {label:"新伤残代码类似于",value:"新伤残代码类似于"},
      {label:"新伤残代码等级等于",value:"新伤残代码等级等于"},
    ],
    placeTypeProperties:[
      {label:"不做选择",value:"不做选择"},
      {label:"事故地点类似于",value:"事故地点类似于"},
      {label:"事故地点不等于",value:"事故地点不等于"},
    ],
    surgeryTypeProperties:[
      {label:"不做选择",value:"不做选择"},
      {label:"手术代码类似于",value:"手术代码类似于"},
    ],
    surgeryTimeTypeProperties:[
      {label:"不做选择",value:"不做选择"},
      {label:"未超认定日后365天",value:"未超认定日后365天"},
    ]
  },

  auditStatus:[
    {label:'待审核',value:'1'},
    {label:'通过',value:'2'},
    {label:'拒绝',value:'3'},
  ],
  publishStatus:[
    {label:'未发布',value:'0'},
    {label:'已发布',value:'1'}
  ],
  status:[
    {label:'待编辑',value:'1'},
    // {label:'待审核',value:'2'},
    {label:'待发布测试环境',value:'3'},
    {label:'已发布测试环境',value:'4'},
    {label:'待发布预生产环境',value:'5'},
    {label:'已发布预生产环境',value:'6'},
    {label:'待发布生产环境',value:'7'},
    {label:'已发布生产环境',value:'8'},
    {label:'任务结束',value:'9'},
  ],
  taskLevel:[
    {label:'一级',value:'1'},
    {label:'二级',value:'2'},
    {label:'三级',value:'3'},
    {label:'四级',value:'4'},
    {label:'五级',value:'5'},
    {label:'六级',value:'6'}
  ],
  flag:[
    {label:'N',value:'0'},
    {label:'Y',value:'1'}
  ],
  isClash:[
    {label:'否',value:'N'},
    {label:'是',value:'Y'}
  ],
  judge:[
    {label:'否',value:'N'},
    {label:'是',value:'Y'}
  ],
  clashDivisor:[
    {label:'规则标识',value:'0'},
    {label:'规则条件',value:'1'},
    {label:'规则动作',value:'2'}
  ],

  // 时间格式化 [例：YYYY-mm-dd HH:MM:SS]
  dateFormat: function (fmt, date) {
    if (typeof date === 'number') {
      date = new Date(date);
    }
    if (!date instanceof Date) {
      return '-';
    }
    date = new Date(date);
    let ret;
    let opt = {
      "Y+": date.getFullYear().toString(),        // 年
      "m+": (date.getMonth() + 1).toString(),     // 月
      "d+": date.getDate().toString(),            // 日
      "H+": date.getHours().toString(),           // 时
      "M+": date.getMinutes().toString(),         // 分
      "S+": date.getSeconds().toString()          // 秒
      // 有其他格式化字符需求可以继续添加，必须转化成字符串
    };
    for (let k in opt) {
      ret = new RegExp("(" + k + ")").exec(fmt);
      if (ret) {
        fmt = fmt.replace(ret[1], (ret[1].length == 1) ? (opt[k]) : (opt[k].padStart(ret[1].length, "0")));
      }
    }
    return fmt;
  },
  getLabel: function (value, properties) {
    let label = ''
    for (let item of properties) {
      if (item.value === value) {
        return item.label
      }
    }
    return label
  },
  clearTag: function(that){
    let activeTag = JSON.parse(sessionStorage.getItem('tagActive'));
    if(activeTag.length > 1){
      activeTag.map((item,index) =>{
        // debugger
        if(item.path == that.$route.path)
          activeTag.splice(index,1);
      })
    } else if (activeTag.length == 1) {
      activeTag.map((item,index) =>{
        // debugger
        if(item.path == that.$route.path && item.path !='/home')
          activeTag.splice(index,1);
      })
    }
    sessionStorage.setItem("tagActive",JSON.stringify(activeTag));
    that.$store.dispatch('setTagActive',activeTag);
  },
  // 获取两个数组对象中相同的值
  getArrDifSameValue:function(arr1,arr2){
    let result = [];
    for (let a = 0; a < arr2.length; a++) {
          let obj = arr2[a];
          let isExist = false;
          for(let j = 0; j < arr1.length; j++){
              let aj = arr1[j];
              if(aj.headType === obj.headType &&
                aj.divisorId === obj.divisorId){
                  isExist = true;
                  break;
              }
          }
          if(isExist){
              result.push(obj);
          }
    }
    return result;
}
}

// 通用数据
export default constant
